/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.bopet.jocadv.core.datum;

import eu.bopet.jocadv.core.Element;
import eu.bopet.jocadv.core.Optimizable;
import java.io.Serializable;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;

/**
 * The class represents datum points in three dimensional space
 *
 * @author bocskapeter
 */
public class Point extends Element implements Serializable, Optimizable {

    // point
    private Vector3D point;

    /**
     * Builds a point as default origin at {0; 0; 0}
     *
     * @return Point
     */
    public static Point getDefaultOrigin() {
        Point origin = new Point("Origin");
        origin.setPoint(Vector3D.ZERO);
        return origin;
    }

    /**
     * Builds a new point at the given coordinates
     *
     * @param vector
     * @return Point
     */
    public static Point getNewPoint(Vector3D vector) {
        Point point = new Point("Point");
        point.setPoint(vector);
        return point;
    }

    /**
     * Default constructor
     *
     * @param name
     */
    public Point(String name) {
        super(name);
    }

    /**
     * Gets the point :)
     *
     * @return point as Vector3D
     */
    public Vector3D getPoint() {
        return point;
    }

    /**
     * Sets the point :)
     *
     * @param point as Vector3D
     */
    public void setPoint(Vector3D point) {
        this.point = point;
    }

    /**
     * Converts to String
     *
     * @return Sting
     */
    @Override
    public String toString() {
        return "\n Point{" + super.toString() + "point=" + point + '}';
    }

    /**
     * Gives the point (variables) of the equation
     *
     * @return array of double values
     */
    @Override
    public double[] getVaraiables() {
        return new double[]{this.point.getX(), this.point.getY(), this.point.getZ()};
    }

}
